package com.yjd.comm.fraudmetrix.util;

import java.util.ArrayList;
import java.util.List;

import com.yjd.comm.fraudmetrix.model.FraudApiResponse;
import com.yjd.comm.fraudmetrix.model.FraudHitrulesModel;
import com.yjd.comm.fraudmetrix.model.HitRule;
import com.yjd.comm.util.FrameUtil;

/**
 * @Description:
 * @author wanganping
 * @date 2015-5-26
 * @version V1.0
 */
public class FraudUtils {

	public static List<FraudHitrulesModel> getHitrules(FraudApiResponse response, Long relId) throws Exception {
		List<FraudHitrulesModel> rulesList = new ArrayList<FraudHitrulesModel>();
		List<HitRule> hitList = response.getHit_rules();
		Long createTime = FrameUtil.getTime(null);
		for (HitRule hitRule : hitList) {
			FraudHitrulesModel hitRulesModel = new FraudHitrulesModel();
			hitRulesModel.setRecord_relid(relId);
			hitRulesModel.setRules_name(hitRule.getName());
			hitRulesModel.setRelues_score(hitRule.getScore());
			hitRulesModel.setRelues_decision(hitRule.getDecision());
			hitRulesModel.setCreate_time(createTime);
			rulesList.add(hitRulesModel);
		}
		return rulesList;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
